package com.qfedu.tantu.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qfedu.tantu.dto.Attractionsdto;
import com.qfedu.tantu.entity.Attractions;
import com.qfedu.tantu.entity.City;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author:rongrong
 * @Description:
 * @Date:Create in 2022/7/2 21:28
 **/


public interface CityDao extends BaseMapper<City> {
    @Select("select *from t_city limit #{start},#{size}")
    List<City> selectPage(@Param("start") int start,@Param("size") int limit);

    @Select("select a.name,a.price,a.imgurl from t_city c inner join t_attractions a on c.id=a.lat where c.id=#{id}")
    List<Attractionsdto> showAll(int id);

    @Select("select id from t_city where english_name=#{name}")
    int selectIdByName(String name);

    @Select("select * from t_city where chinese_name=#{name}")
    City selectByName(String name);

    /**
     * 通过 游记数量降序排列 城市
     */
    @Select("select chinese_name,img_url from t_city order by num desc")
    List<City> ord();

}
